package pers.qianyu.comment.converter;

import org.mapstruct.*;
import pers.qianyu.comment.pojo.dto.*;
import pers.qianyu.comment.pojo.entity.*;
import pers.qianyu.comment.pojo.vo.*;

import java.time.format.*;
import java.util.*;

@Mapper(componentModel = "spring", imports = {DateTimeFormatter.class, ArrayList.class})
public interface CommentConverter {
    @Mapping(source = "createTime", target = "createTime", dateFormat = "yyyy-MM-dd HH:mm:ss")
    @Mapping(source = "updateTime", target = "updateTime", dateFormat = "yyyy-MM-dd HH:mm:ss")
    @Mapping(target = "children", expression = "java(new ArrayList<>())")
    CommentVO convertToVO(CommentPO commentPO);

    List<CommentVO> convertToVOS(List<CommentPO> commentPOS);

    CommentPO convertToPO(CommentDTO commentDTO);
}
